/**
 * Created by mhy on 2018/1/17.
 */

$(document).ready(function() {
    var buttons = $(".navbar-right").find("button.btn");

    /*管理员获得对应的借阅列表按钮*/
    buttons.eq(0).click(function () {
        toAllPaymentList();
    });
    buttons.eq(1).click(function () {
        toOutDatePaymentList();
    });
    buttons.eq(2).click(function () {
        toLostPaymentList();
    });
});

function allPaymentsList(e) {
    var $this = $(e);
    var pageNum = $this.text();
    var pageSize = $("#pageSize").val();

    var $form = $("<div class='postForm'></div>");
    var $elem = $("<div class='postParam'></div>");

    $elem.attr("id","pageNum");
    $elem.text(pageNum);
    $form.append($elem.clone());

    $elem.attr("id","pageSize");
    $elem.text(pageSize);
    $form.append($elem.clone());

    postForm("allPaymentsListPage",$form);
}

function lostPaymentsList(e) {
    var $this = $(e);
    var pageNum = $this.text();
    var pageSize = $("#pageSize").val();

    var $form = $("<div class='postForm'></div>");
    var $elem = $("<div class='postParam'></div>");

    $elem.attr("id","pageNum");
    $elem.text(pageNum);
    $form.append($elem.clone());

    $elem.attr("id","pageSize");
    $elem.text(pageSize);
    $form.append($elem.clone());

    $elem.attr("id","reason");
    $elem.text(2);
    $form.append($elem.clone());

    postForm("paymentsListPageByReason",$form);
}

function outDatePaymentsList(e) {
    var $this = $(e);
    var pageNum = $this.text();
    var pageSize = $("#pageSize").val();

    var $form = $("<div class='postForm'></div>");
    var $elem = $("<div class='postParam'></div>");

    $elem.attr("id","pageNum");
    $elem.text(pageNum);
    $form.append($elem.clone());

    $elem.attr("id","pageSize");
    $elem.text(pageSize);
    $form.append($elem.clone());

    $elem.attr("id","reason");
    $elem.text(1);
    $form.append($elem.clone());

    postForm("paymentsListPageByReason",$form);
}


